const express=require("express");
const cors = require("cors");
const bodyparser=require('body-parser');
const cookieParser=require("cookie-parser");
const app=express();
const loginRouter=require('./routes/loginRouter.js');
const gmtoolRouter=require('./routes/gmtoolRouter');
const gmNoticeRouter=require('./routes/gmNotice');
const playerRouter=require('./routes/playerRouter');
const roleRouter=require('./routes/roleRouter');
const paymentRouter=require('./routes/paymentRouter');
const retentionRouter=require('./routes/retentionRouter');
app.use(cors());
//导入bodyparser获取前端传过来的数据
app.use(bodyparser.json());
app.use(bodyparser.urlencoded({extended:false}));
app.use("/login",loginRouter);
app.use("/gmtool",gmtoolRouter);
app.use("/player",playerRouter);
app.use("/role",roleRouter);
app.use("/payment",paymentRouter);
app.use("/retention",retentionRouter);
app.use("/gmnotice",gmNoticeRouter);
//使用cookieParser生成cookie
app.use(cookieParser());
var server=app.listen(3000,'0.0.0.0',function(){
	var host = server.address().address;
	var port = server.address().port;
    console.log(host,port,'服务器启动成功.....');
});